{extend name="$base" /}
{block name="resources"}
<link rel="stylesheet" type="text/css" href="WAP_CSS/member_apply_withdrawal.css">
{/block} 
{block name="main"}
{php}
	$balance_config = api("System.Config.balanceWithdraw");
	$balance_config = $balance_config['data'];
 	$poundage = $balance_config['value']["withdraw_multiple"];
	$cash = $balance_config['value']["withdraw_cash_min"];
	$withdraw_message = $balance_config['value']["withdraw_message"];

	$account = api('System.Member.memberBalance');
	$account = $account['data'];

{/php}

<div class="panel">
	<span>{:lang('member_balance')}：</span>
	<span class="ns-text-color text18" id="Amount">¥{$account}</span>
</div>

<div style="display: flex">
	<div style="flex: 0 0 80px;background-color: white" class="s-center">
		<span>账号</span>
	</div>
	<div style="flex: 1">
		<input type="text" id="user_name" placeholder="请输入转入会员账号">
	</div>
</div>
<div style="display: flex">
	<div style="flex: 0 0 80px;background-color: white" class="s-center">
		<span>姓名</span>
	</div>
	<div style="flex: 1">
		<input type="text" id="nick_name" placeholder="请输入转入会员姓名">
	</div>
</div>

<div style="display: flex">
	<div style="flex: 0 0 80px;background-color: white" class="s-center">
		<span>金额</span>
	</div>
	<div style="flex: 1">
		<input type="number" id="money" placeholder="请输入转账金额">
	</div>
</div>


	<div class="tip-text ns-text-color">转账最小金额100元，必须为100的倍数。</div>

	<div class="btn-wrap">
		<a href="javascript:;" onclick="btnSave()" class="button ns-bg-color">立即转账</a>
	</div>

{/block}
{block name="footer"}{/block}
{block name="script"}
<script>
	function btnSave() {
		var user_name = $("#user_name").val();
		var nick_name = $("#nick_name").val();
		var money = $("#money").val();
		money = Number(money);
		api('System.Member.transfer', {
			"user_name": user_name,
			"nick_name": nick_name,
			"money": money,
			"account_type": 2
		}, function (res) {
			console.log(res);
			if (res.data > 0) {
				toast(res.message);
				window.location.href = __URL(APPMAIN + "/member/balance");
			} else {
				toast(res.message);
			}
		})
	}
</script>
{/block}